/**
 *	\file
 *	\brief indicates a small set of useful tools to read the parser in a better way
 *
 * 	\date Aug 12, 2013
 * 	\author koldar
 */

#ifndef PARSER_TOOLS_H_
#define PARSER_TOOLS_H_

#include "SyntaxNode.h"
#include <stdbool.h>

/**indicates the maximum filename length that a dot file can have
 *
 */
#define __PARSER_TOOLS_MAX_FILENAME_LENGTH 50

/**generate in the graph directory (CustomProgrammingLanguage/grp) a .dot file representing the syntax tree
 *
 *	\pre
 *	 \li filename contains only the name of the file (no extension);
 *	 \li filename does hold no "/" or other directory access tokens;
 *	 \li filename is a correct name for a file in the OS;
 *	 \li root is not NULL;
 *	 \li the syntax tree is correct;
 *	\post
 *	 \li up to 2 files (.jpg and .dot) are created in the directory grp of CustomProgrammingLanguage, depending of the current
 *	 	values of jpgimage and removedotfile
 *	 \li the generated files are stored in the directory grp
 *
 * @param filename the name of the file
 * @param root the SyntaxNode used to represents the root of the syntax tree
 * @param jpgimage if TRUE a jpg image is generated automatically; if FALSE, only .dot file is generated
 * @param removedotfile if TRUE the generated dot file is removed from the file system; this option makes some sense only if jpgimage is set to TRUE
 * @return TRUE if there is no error in the function, FALSE otherwise. Error can be:
 * 	\li cannot create the file
 * 	\li dot can't compile the dot file generated
 * 	\li the dot file cannot be removed from the file system
 */
bool buildSyntaxTreeGraph(const char* filename,PSyntaxNode root,bool jpgimage,bool removedotfile);

#endif /* PARSER_TOOLS_H_ */
